package com.zhongwang.business.common;

import com.zhongwang.business.constant.Constant;
import com.zhongwang.business.util.ServletUtils;
import lombok.Data;

/**
 *  分页支持工具
 *
 * @author China.sgl
 * @date 2019/9/10 16:07
 */
@Data
public class Page {

    /**
     * 当前页
     */
    private Integer pageNum;

    /**
     * 每页显示数量
     */
    private Integer pageSize;

    /**
     * 获取分页参数对象
     *
     * @return page
     */
    public static Page getPage() {
        Page page = new Page();
        page.setPageNum(ServletUtils.getIntParameter(Constant.PAGE_NUM));
        page.setPageSize(ServletUtils.getIntParameter(Constant.PAGE_SIZE));
        return page;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public Page setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
        return this;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public Page setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }
}
